package com.pinganfu.mock.control;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSON;

public class AbsJsonObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final String SUCCESS_OK = "true";
	public static final String SUCCESS_FAIL = "false";

	/**
	 * 执行成功与否：true/false
	 */
	String success = "success";
	/**
	 * 返回消息
	 */
	Map<String, Object> message = new HashMap<String, Object>();

	// 全局错误信息
	String globalErrorStr = null;

	public AbsJsonObject(String successFlag) {
		message.put(success, successFlag);
	}
	
	public void addMessage(String key, Object value){
		message.put(key, value);
		
	}
	
	public void addMessage(Map<String, Object> m){
		message.putAll(m);
		
	}
	
	public String messageToJsonString(){
	     return JSON.toJSONString(message);
	}

	public Map<String, Object> getMessage() {
		return message;
	}

	public void setMessage(Map<String, Object> message) {
		this.message = message;
	}
	
	

}
